package com.woniuxy.hrp.mapper;

import com.woniuxy.hrp.entity.ArrangeTime;
import com.woniuxy.hrp.entity.Perm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @program: hrph
 * @InterfaceName PermMapper
 * @description:权限Mapper
 * @author: WY
 **/
@Mapper
public interface PermMapper {
    //查询
    @Select("select *from hrp_perm_mid hp,hrp_perm r where hp.perm_id=r.id and hp.admin_id=#{adminid}")
    List<Perm> getById(int adminid);

    //根据状态查询
    @Select("select *from hrp_perm where status='y'")
    List<Perm> getByStatus();

    //删除(逻辑)
    @Update("update hrp_perm set status='n' where id=#{id}")
    void updatestatus(int id);

    @Select("select * from hrp_perm hdt,hrp_perm_mid ha where hdt.id=ha.perm_id and ha.doctor_id=#{doctorid}")
    List<Perm> getByDoctorId(int doctorid);
}
